Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

188
Visualizações
Javascript .replace() method failing replacing ".–" with ".00"

I have a page displaying a price with .– instead of decimals .00:

<span id="product_price">123.&ndash;</span>

I am trying to switch its ending from ".–" to ".00" (or to nothing) in order to dynamically build the URL of a PayPal (unregistered) payment button, and cannot understand why Javascript's .replace() method fails replacing the .&ndash;.

Although the source code of the page shows the price is correctly written with the .&ndash; in the <span>, the console.log(amount); prints the amount with a - instead of the character entity:

var amount = jQuery("span#product_price").html();
console.log(amount);
amount = amount.toString(); // just to be sure
amount.replace('.&ndash;','.00');

Hence, I also tried amount.replace('.-','.00');

and var amount = jQuery("span#product_price").html().replace('.&ndash;','.00');

Nothing works. What I'm doing wrong? Thanks.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda